export default {
  totalCount (state) {
    let cart = state.cart.filter(item => item.checked)
    return cart.reduce((result, item) => {
      result += item.count
      return result
    }, 0)
  },
  totalPrice (state) {
    let cart = state.cart.filter(item => item.checked)
    return cart.reduce((result, item) => {
      result += item.count * item.price
      return result
    }, 0)
  },
  allCount (state) {
    let count = 0
    state.cart.map(item => {
      count += item.count
    })
    return count
  }
}
